/*
 *
 *
 *
 *
 */

package com.usefullc.user.domain;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.usefullc.system.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.*;
import java.util.List;

@JsonIgnoreProperties(value = {"authResList","delState"})
@Entity(name="u_role")
@ApiModel("角色")
@Data
public class Role extends BaseEntity {


    @ApiModelProperty(notes = "名称")
    @Column(length = 50,nullable = false)
    private String name;

    @ApiModelProperty(notes = "描述")
    @Column(length = 1000,nullable = true)
    private java.lang.String description;


    @ApiModelProperty(notes = "资源列表")
    @JSONField(serialize = false)
    @ManyToMany(cascade = {CascadeType.REFRESH},fetch=FetchType.EAGER)
    @JoinTable(name = "u_role_auth_res", joinColumns = {
            @JoinColumn(name = "roleId", referencedColumnName = "id")}, inverseJoinColumns = {
            @JoinColumn(name = "authResId", referencedColumnName = "id")})
    private List<AuthRes> authResList;

    public Role(){
    }

}
